Dynomotion

Group: DynoMotion Message: 8331 From: Hugh Sontag Date: 9/12/2013
Subject: Moving using a C program
Hi Tom,

I'm interested in using the KFLOP user programs to actually cut parts. I'm very familiar with C, and the opportunity to use a capable, structured programming language is very attractive.

I found the "KMotionDef.h" file, which has some clues as to the "API" of KFLOP.

It looks like all the native motion commands are in "absolute coordinates", which I suspect is encoder counts for our CNC router with brushless DC motors and encoders. 

If I want to move in a straight line from a point in 3-space ABC to a second point XYZ at a particular rate, I suspect I need to call 

void SetupForMove(double From, double To, float MaxVel, CHAN *ch, int CoeffOffset,
                                                  int NoJerkControlAtStart, 
                                                  int NoJerkControlAtEnd,
                                                  int Start);

and then call 

StartMove()

There is also 

void MoveXYZABC(double x, double y, double z, double a, double b, double c); // Moves 6 axes (each axis moves independently)
int CheckDoneXYZABC(); // Check if all CS axis have completed , returns 1 if all complete, -1 if any is disabled, otherwise 0

--> Which calls should I use to move in a straight line, at a predetermined rate?

--> How can I know when the move completes?

--> Do you have any comment on the advisability of using this approach?

Thanks,
Hugh


Group: DynoMotion Message: 8336 From: Tom Kerekes Date: 9/12/2013
Subject: Re: Moving using a C program
Hi Hugh,

I wouldn't really recommend that approach of using KFLOP stand-alone to cut parts.  KFLOP itself only has basic independent motion capability.  The routines you listed either move one axis only, or multiple axes but each independently.  This will not necessarily be along a straight line.  So for example moving 5 inches in x and 10 inches in y (at the same time) will result in a dog leg type of path.

There are methods  to do simple coordinated motions.  See the examples CoordMotionInKFLOP.c and CoordMotionInKFLOPArc.c.  But using these it is up to you to do all the trajectory planning of any required accelerations and velocities yourself.

We provide extensive Motion Control Libraries that handle motion paths and will do Trajectory Planning, Kinematics, Geo Corrections, Buffering, downloading, etc for you.  But these libraries run under Windows on the PC.  But if your desire is to write C++ code (or C, or VB, or C#) then it would be much simpler and powerful to make use of those.  See the C:\KMotion431k\PC VC Examples\SimpleCoordMotion for a C++ example.  Or see the C:\KMotion431i\PC VCS Examples\KMotion_dotNet Console for a C# example.

HTH
Regards
TK